<?php

require_once './model/BookDetailEntity.php';

/**
 * 
 * @author prg
 *
 */
abstract  class GetBookDetailInfo 
{
	/**
	 * 
	 * @var BookDetailEntity
	 */
	protected  $detail_entity;
	
	/**
	 * 
	 * @var string
	 */
	protected  $detail_url;
	
	/**
	 * 
	 * @var string
	 */
	protected $page_content;
	/**
	 *
	 * @param string $detail_url
	 * @param BookBaseEntity $book
	 */
	function __construct($detail_url,$book)
	{
		$this->detail_url    = $detail_url;
		$this->detail_entity = new BookDetailEntity($book);
	}
	
	/**
	 * 打开连接获取网页数据
	 */
	function openUrl()
	{
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL,$this->detail_url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$this->page_content = curl_exec($ch);
		curl_close($ch);
	}
	
	/**
	 * 
	 * @param string $ibsn
	 */
	function setBookIbsn($ibsn)
	{
		$this->detail_entity->_IBSN = $ibsn;
	}
	
	/**
	 * 
	 * @param string $time
	 */
	function setBookPublishTime($time)
	{
		$this->detail_entity->_PUBLISH_TIME = $time;
	}
	
	/**
	 * 
	 * @param int $nums
	 */
	function setBookEditionNum($nums)
	{
		$this->detail_entity->_EDITION_NUM = $nums;
	}
	
	/**
	 * 
	 * @param int $pages
	 */
	function setBookPages($pages)
	{
		$this->detail_entity->_PAGES = $pages;
	}
	
	/**
	 * 
	 * @param string $time
	 */
	function setBookPrintTime($time)
	{
		$this->detail_entity->_PRINT_TIME = $time;
	}
	
	/**
	 * 
	 * @param int $size
	 */
	function setBookSize($size)
	{
		$this->detail_entity->_BOOK_SIZE = $size;
	}
	
	
	/**
	 * 
	 * @param string $describe
	 */
	function setBookDescribe($describe)
	{
		
		$this->detail_entity->_DESCRIBE = $describe;
	}
	
	
	/**
	 * 
	 * @param string $author_info
	 */
	function setBookAuthorInfo($author_info)
	{
		$this->detail_entity->_AUTHOR_INFO = $author_info;
	}
	
	/**
	 * 
	 * @param string $catalogue
	 */
	function setBookCatalogue($catalogue)
	{
		$this->detail_entity->_CATALOGUE = $catalogue;
	}
	
	/**
	 * 设定所有的信息
	 */
	abstract  function setBookDetailInfo();
	
	/**
	 *
	 * @return BookDetailEntity
	 */
	abstract  function getDetailBookEntity();
}
?>